package com.zqh.app.manager.impl;

import com.zqh.app.dao.ClassifyMapper;
import com.zqh.app.entity.SungoClassify;
import com.zqh.app.manager.ClassifyManager;
import com.zqh.common.entity.Page;
import com.zqh.common.entity.Query;
import com.zqh.common.entity.R;
import com.zqh.common.utils.CommonUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service("classifyManager")
public class ClassifyManagerImpl implements ClassifyManager {
    @Autowired
    ClassifyMapper classifyMapper;

    @Override
    public List<SungoClassify> getSungoClassifyList(Page<SungoClassify> page, Query form) {
        return classifyMapper.listForPage(page,form);
    }

    @Override
    public R delClassifys(int classifyId) {
        int count = classifyMapper.remove(classifyId);
        return CommonUtils.msg(count);
    }

    @Override
    public R addClassifys(Query form) {
        int count = classifyMapper.save(form);
        return CommonUtils.msg(count);
    }

    @Override
    public R updateClassifys(Query form) {
        int count = classifyMapper.update(form);
        return CommonUtils.msg(count);
    }
}
